package entities;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="intrebari")
@NamedQueries({
	@NamedQuery(name="getIntrebariByChestionarId", 
				query="SELECT i FROM Intrebari i WHERE i.chestionare=:ch_idParam")
})

public class Intrebari implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	private int id;
	
	private int tip;
	
	private String intrebare;
	
	@OneToMany (mappedBy="intrebari")
    private List<Raspunsuri> raspunsuri;
	
	@ManyToOne
	@JoinColumn(name = "id_chestionar")
	private Chestionare chestionare;
	
	public Intrebari(){
		super();
	}
	
	public Intrebari(int id, Chestionare chestionare, int tip, String intrebare){
		this.id = id;
		this.chestionare = chestionare;
		this.tip = tip;
		this.intrebare = intrebare;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getTip() {
		return tip;
	}

	public void setTip(int tip) {
		this.tip = tip;
	}

	public String getIntrebare() {
		return intrebare;
	}

	public void setIntrebare(String intrebare) {
		this.intrebare = intrebare;
	}

	public List<Raspunsuri> getRaspunsuri() {
		return raspunsuri;
	}

	public void setRaspunsuri(List<Raspunsuri> raspunsuri) {
		this.raspunsuri = raspunsuri;
	}
	/*
	public int getId_chestionar() {
		return id_chestionar;
	}

	public void setId_chestionar(int id_chestionar) {
		this.id_chestionar = id_chestionar;
	}
	*/

	public Chestionare getChestionare() {
		return chestionare;
	}

	public void setChestionare(Chestionare chestionare) {
		this.chestionare = chestionare;
	}
}
